package org.ala.distributed_transaction_test.test_1.update;

import java.util.HashSet;
import org.ala.distributed_transaction_test.test_1.query.Test1Query;
import java.lang.Long;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.HashMap;
import java.lang.String;
import java.lang.Integer;
import java.io.Serializable;


/**
 *	BatchUpdate (test_1)
 *  
 *  update test_1
 *  	set ${update_column} case ${queryColumn} = 
 *  		when #{queryColumn_key1} then #{queryColumn_value1}
 *  		when #{queryColumn_key2} then #{queryColumn_value2}
 *  		...
 *  		else ${update_column}
 *  	end
 *  where
 *  	${queryColumn} in (queryColumnValues1, queryColumnValues2, ... )
 *
 *	@author 骆毅 (ala)
 *	@date 2024-02-17 11:44:18
 */
public class Test1BatchUpdate implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	
	/**
	 * update queryColumn
	 */
	protected String queryColumn;
	/**
	 * update queryColumnValues
	 */
	protected Set<Object> queryColumnValues;
	/**
	 * another query
	 * <p>	create Boot key
	 */
	protected Collection<Test1Query> querys;


	/**
	 *	update column id
	 */
	protected Map<Object, Long> id;
	/**
	 *	update column name
	 */
	protected Map<Object, String> name;
	/**
	 *	update column age
	 */
	protected Map<Object, Integer> age;
	/**
	 *	update column sex
	 */
	protected Map<Object, Integer> sex;


	/**
	 *	build by update column id
	 */
	public static Test1BatchUpdate buildById() {return new Test1BatchUpdate().queryColumn("id");}
	/**
	 *	build by update column name
	 */
	public static Test1BatchUpdate buildByName() {return new Test1BatchUpdate().queryColumn("name");}
	/**
	 *	build by update column age
	 */
	public static Test1BatchUpdate buildByAge() {return new Test1BatchUpdate().queryColumn("age");}
	/**
	 *	build by update column sex
	 */
	public static Test1BatchUpdate buildBySex() {return new Test1BatchUpdate().queryColumn("sex");}


	public String getQueryColumn() {
		return queryColumn;
	}
	public void setQueryColumn(String queryColumn) {
		this.queryColumn = queryColumn;
	}
	public Test1BatchUpdate queryColumn(String queryColumn) {
		setQueryColumn(queryColumn);
		return this;
	}
	
	
	public Set<Object> getQueryColumnValues() {
		return this.queryColumnValues;
	}
	public void appendQueryColumnValue(Object queryColumnValue) {
		if (this.queryColumnValues == null) {this.queryColumnValues = new HashSet<>();}
		this.queryColumnValues.add(queryColumnValue);
	}
	
	
	public Collection<Test1Query> getQuerys() {
		return querys;
	}
	public void setQuerys(Collection<Test1Query> querys) {
		this.querys = querys;
	}
	public Test1BatchUpdate querys(Collection<Test1Query> querys) {
		setQuerys(querys);
		return this;
	}
	

	public Test1BatchUpdate updateId(Object queryColumnValue, Long id) {
		if (this.id == null) {this.id = new HashMap<>();}
		this.id.put(queryColumnValue, id);
		appendQueryColumnValue(queryColumnValue);
		return this;
	}
	public Map<Object, Long> getId() {
		return this.id;
	}
	
	public Test1BatchUpdate updateName(Object queryColumnValue, String name) {
		if (this.name == null) {this.name = new HashMap<>();}
		this.name.put(queryColumnValue, name);
		appendQueryColumnValue(queryColumnValue);
		return this;
	}
	public Map<Object, String> getName() {
		return this.name;
	}
	
	public Test1BatchUpdate updateAge(Object queryColumnValue, Integer age) {
		if (this.age == null) {this.age = new HashMap<>();}
		this.age.put(queryColumnValue, age);
		appendQueryColumnValue(queryColumnValue);
		return this;
	}
	public Map<Object, Integer> getAge() {
		return this.age;
	}
	
	public Test1BatchUpdate updateSex(Object queryColumnValue, Integer sex) {
		if (this.sex == null) {this.sex = new HashMap<>();}
		this.sex.put(queryColumnValue, sex);
		appendQueryColumnValue(queryColumnValue);
		return this;
	}
	public Map<Object, Integer> getSex() {
		return this.sex;
	}
	

}
